package com.ctshk.rpc.order.custom.provider;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ctshk.rpc.order.custom.req.order.CustomOrderIdReq;
import org.apache.ibatis.annotations.Param;

/**
 * 订单折扣记录provider
 */
public class CustomOrderDiscountProvider {

    public String selectListBySelective(@Param("page") IPage<CustomOrderIdReq> page, @Param("req") CustomOrderIdReq req) {
        StringBuilder sb = new StringBuilder();
        sb.append("select tsod.id, tsod.order_id, tsod.tourist_id, " +
                "tsoti.cn_surname, tsoti.cn_name, " +
                "tsod.check_status, " +
                "tsod.before_amount, tsod.discount_amount, " +
                "tsod.remark, tsod.create_id, tsod.gmt_create, tsod.discount_type_id, tsod.discount_type " +
                "from t_customized_order_discount tsod ");
        sb.append("left join t_customized_order_tourist_info tsoti ON tsod.tourist_id = tsoti.id ");
        sb.append("where tsod.is_deleted = 0 ");
        sb.append("and tsod.order_id = #{req.id} ");
        return sb.toString();
    }

}
